﻿#ifndef __AF_RUNBASE_H__
#define __AF_RUNBASE_H__

#include "AF_Define.h"

namespace AF
{
	_INTERFACE Runnable;
	class RunBase;
}
typedef AF::Runnable			AF_IRunnable;
typedef AF::RunBase			AF_CRunBase;

namespace AF
{
	/// 计时对象响应接口
	_INTERFACE Runnable
	{
	public:
		/// 当响应时
		/**
		 *  @returns
		 *	返回是否继续。
		 */
		virtual void		OnRun(AF_CRunBase* pRunBase) = 0;
	};

	/// 计时对象基类
	class _ABSTRACT RunBase
	{
	public:
		RunBase() :
			ATTRIB(Interval)(0),
			ATTRIB(RunClass)(NULL)
		{}
		
		virtual ~RunBase(){}

	public:
		/// 响应时间属性
		DIM_ATTRIB(TimeTicks, Interval);
		/// 响应对象属性
		DIM_ATTRIB(Runnable*, RunClass);
	};
}

#endif